package top.yueyazhui.order.controller;

import io.seata.rm.tcc.api.BusinessActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.yueyazhui.common.feign.OrderFeign;
import top.yueyazhui.order.service.OrderService;

@RestController
public class OrderController implements OrderFeign {

    @Autowired
    OrderService orderService;

    @Override
    public boolean prepare(BusinessActionContext businessActionContext, String userId, String commodityCode, Integer count, Double money) {
        return orderService.prepare(businessActionContext, userId, commodityCode, count, money);
    }

    @Override
    public boolean commit(BusinessActionContext businessActionContext) {
        return orderService.commit(businessActionContext);
    }

    @Override
    public boolean rollback(BusinessActionContext businessActionContext) {
        return orderService.rollback(businessActionContext);
    }
}
